<script setup lang="tsx">
import { ref } from "vue";

const props = defineProps({
  data: {
    type: Array,
    default: () => []
  }
});

const columns = [
  {
    label: "关键词",
    prop: "name",
    cellRenderer: ({ row }) => {
      const keyword = row!.name.substring(0, 6);
      return <span>{keyword}</span>;
    }
  },
  {
    label: "总检索次数",
    prop: "count"
  },
  {
    label: "检索频次（最近一周）",
    prop: "count1"
  }
];
</script>

<template>
  <div>
    <el-scrollbar>
      <pure-table
        ref="tableRef"
        border
        adaptive
        row-key="id"
        alignWhole="center"
        showOverflowTooltip
        :data="data"
        :columns="columns"
      />
    </el-scrollbar>
  </div>
</template>
